<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});


//购物车页面
Route::get('/shop','Home\IndexController@index');

//商品详情页
Route::get('/detail','Home\IndexController@detail');

//文件上传页面
Route::get('/upfield','Home\IndexController@up');

//验证码
Route::get('/makecode', 'Api\CommonApi@buildCode');

//文件上传的路由
Route::post('/upload', 'Api\CommonApi@upload');


//登录路由
Route::get('/register','Home\UserController@registerView');
Route::get('/login','Home\UserController@loginView');


//注册路由
Route::post('/doregister','Api\UserApi@handlerRegister');
Route::post('/dologin','Api\UserApi@handlerSignIn');

//资源管理



Route::prefix('admin')->group(function () {


	Route::middleware(['admin.auth'])->group(function () {

	Route::resource('/product','Admin\ProductController');

	Route::get('/product/delete/{gayquan}', 'Admin\ProductController@destroy')
	        ->where(['gayquan' => '\d+']);		

	});

	Route::get('login', function () {
      return '后台登录页面';
    });



});